<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 5. Image toolkit</a>
</td><td width="60%">
<p align="center">
=====================================<br />
5.2 Loading a .bmp or .png image<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
You can read data from a .bmp or .png file (for example to draw an image using the background color of the console cells).<br />
Note that only 24bits and 32bits PNG files are currently supported.<br />
<p class="code"><pre>
C++ : TCODImage::TCODImage(const char *filename)
C   : TCOD_image_t TCOD_image_load(const char *filename)
Py  : image_load(filename)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>filename</td><td>Name of the .bmp or .png file to load.</td></tr>
</table>
Example :<br />
<p class="code"><pre>
C++ : TCODImage *pix = new TCODImage("mypic.bmp");
C   : TCOD_image_t pix = TCOD_image_load("mypic.bmp");
Py  : pix = libtcod.image_load("mypic.bmp")
</pre></p>
